Currently, a virtual system can provide a user with contiguous logical space for data storage, and the logical space is also referred to as a logical unit number (LUN). A relationship of mapping a data block from logical space to actual physical space is recorded in metadata. FIG. 1 shows a virtualized storage structure. Metadata may be stored in a form of a binary tree or a multi-way tree. The metadata includes one root node and multiple intermediate nodes. The root points, by using intermediate nodes, to intermediate nodes at tail ends of branches (also referred to as leaves). Each leaf corresponds to one data node, and the data nodes may be located in different physical devices. All the data nodes form a piece of virtual data, and a length of a data node is in direct proportion to a size of storage space occupied by the data node.
However, if the metadata is damaged, the root is disconnected from the data nodes, resulting in a failure in reading the virtual data. In the prior art, to overcome the foregoing problem, as shown in FIG. 2, all currently used metadata (a primary file) is backed up to obtain a backup file (a secondary file) of the primary file. When the primary file is damaged, the virtual data is successfully read by using the secondary file.
In the foregoing process of implementing metadata recovery, the prior art has at least the following problem: When both the primary file and the secondary file are damaged, the root is disconnected from the data nodes, resulting in a failure in reading the virtual data.